package junior.Simulation模拟;

import java.util.Scanner;

public class 删除字符 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String word = scan.nextLine();
        StringBuffer sBuffer = new StringBuffer(word);
        int l = sBuffer.length();
        int t = scan.nextInt();

        for(int i = 0; t > 0;i++){
            char min = sBuffer.charAt(i);
            int index = i;
            if(i+t==sBuffer.length()){
                sBuffer.delete(sBuffer.length()-t,sBuffer.length());
                break;
            }
            for(int j = i; j <= i+t;j++ ){
                if(sBuffer.charAt(j)<min){
                    min = sBuffer.charAt(j);
                    index = j;
                }
            }
            if(index!=i){
                sBuffer.delete(i,index);
            }

            t-=index-i;
        }

        System.out.println(sBuffer);

        scan.close();
    }
}
